// filename: test_cilkplus.cpp
// compile: g++ test_cilkplus.cpp -lcilkrts

#include <stdio.h>
#include <unistd.h>

#include <cilk/cilk.h>
#include <cilk/cilk_api.h>

void task(int i) {
    printf("task: %d, workder id: %d\n", i, __cilkrts_get_worker_number());
    sleep(1);
}

int main() {
    for(int i=0;i<10;i++)
        cilk_spawn task(i);
    cilk_spawn task(-1);
    cilk_sync;
    return 0;
}

